<template>
    <div class="order">
        <div class="header">
            <div class="bar">
                <h1>我的订单</h1>
                <div class="back" @click="back">
                    <i class="iconfont icon-left"></i>
                </div>
            </div>
            <ul class="nav">
                <li class="item active">全部</li>
                <li class="item">待支付</li>
                <li class="item">待取餐</li>
                <li class="item">退款售后</li>
                <li class="line"></li>
            </ul>
        </div>
        <div class="list">
            <div class="box" v-for="item in 6" @click="goToOrderDetail">
                <div class="top">
                    <div class="left">
                        <div class="pic">
                            <img src="@/assets/img/myavatar.png" alt="">
                        </div>
                        <div class="info">
                            <h1>得胜桥豆花米线</h1>
                            <p>在店里吃</p>
                        </div>
                    </div>
                    <div class="right">
                        <p>餐品制作中</p>
                    </div>
                </div>
                <div class="content">
                    <div class="num-box">
                        <div class="number">
                            <div class="title">
                                <div class="pic">
                                    <img src="@/assets/img/myicon.png" alt="">
                                </div>
                                <span>取餐号</span>
                            </div>
                            <h1>0098</h1>
                            <p>排在第N位</p>
                        </div>
                    </div>

                    <div class="img-list">
                        <div class="item">
                            <div class="pic">
                                <img src="@/assets/img/mygoods1.png" alt="">
                                <p>我是商品标…</p>
                            </div>
                        </div>
                        <div class="item">
                            <div class="pic">
                                <img src="@/assets/img/mygoods2.png" alt="">
                                <p>我是商品标…</p>
                            </div>
                        </div>
                        <div class="item">
                            <div class="pic">
                                <img src="@/assets/img/mygoods2.png" alt="">
                                <p>我是商品标…</p>
                            </div>
                        </div>
                    </div>
                    <div class="total">
                        <p class="price">¥28.00</p>
                        <p class="total">共3件</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { useRouter } from 'vue-router';
const router = useRouter()
const back = () => {
    router.push('/')
}

const goToOrderDetail= ()=>{
    router.push('/orderdetail')
}
</script>

<style scoped lang="scss">
.order {
    background: #eee;
    min-height: 100vh;

    .header {
        background: #fff;

        .bar {
            padding: 30px 15px 20px 15px;
            position: relative;
            text-align: center;
            color: #000;

            h1 {
                font-size: 17px;
            }

            .back {
                position: absolute;
                left: 15px;
                top: 20px;

                .iconfont {
                    font-size: 30px;
                    color: #666;
                }
            }

        }

        .nav {
            position: relative;
            padding: 12px 40px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 15px;
            color: #333;

            .item {
                &.active {
                    color: #2493F1;
                }
            }

            .line {
                position: absolute;
                width: 28px;
                height: 2px;
                background: #2493F1;
                left: 40px;
                top: 35px;
            }
        }
    }

    .list {
        padding: 10px;

        .box {
            background: #fff;
            border-radius: 8px;
            margin-bottom: 10px;

            .top {
                padding: 12px;
                display: flex;
                align-items: center;
                justify-content: space-between;

                .left {
                    display: flex;
                    align-items: center;

                    .pic {
                        width: 36px;
                        height: 36px;
                        border-radius: 1px;
                        overflow: hidden;

                        img {
                            width: 100%;
                            height: 100%;
                        }
                    }

                    .info {
                        margin-left: 5px;

                        h1 {
                            font-size: 15px;
                            color: #333;
                        }

                        p {
                            margin-top: 2px;
                            display: inline-block;
                            border: 1px solid #2493F1;
                            background: #f0f8ff;
                            color: #2493F1;
                            font-size: 10px;
                            padding: 3px;
                            border-radius: 2px;
                        }
                    }
                }

                .right {
                    p {
                        font-size: 14px;
                        color: #2493F1;
                    }
                }
            }

            .content {
                display: flex;
                padding-bottom: 10px;
                .number {
                    border-radius: 6px;
                    margin: 5px;
                    padding: 5px;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;
                    border: 1px solid #B3DCFF;

                    .title {
                        display: flex;

                        .pic {
                            width: 12px;
                            height: 12px;

                            img {
                                width: 100%;
                                height: 100%;
                            }
                        }

                        span {
                            color: #2493F1;
                            font-size: 11px;
                        }
                    }

                    h1 {
                        font-size: 26px;
                        color: #333;
                    }

                    p {
                        font-size: 10px;
                        color: #999;
                    }
                }

                .img-list {
                    display: flex;
                    flex: 1;
                    overflow: scroll;

                    .pic {
                        margin-right: 8px;

                        img {
                            width: 75px;
                            height: 65px;
                            border-radius: 2px;
                        }

                        p {
                            font-size: 12px;
                            color: #666;
                        }
                    }
                }

                .img-list::-webkit-scrollbar {
                    display: none;
                }

                .total{
                    width: 90px;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    .price{
                        font-size: 15px;
                        color:#333;
                        margin-bottom: 12px;
                    }
                    .total{
                        font-size: 12px;
                        color:#999;
                    }
                }
            }
        }
    }
}
</style>